package com.saydc.actions.capacitaciones;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.saydc.model.Empleado;

public class MarcarEmpleadoCapacitadoAction extends Action {

	@SuppressWarnings("unchecked")
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) throws Exception {
		
		int idxEmpleado = Integer.parseInt(request.getParameter("idx"));
		int idCapacitacion = Integer.parseInt(request.getParameter("idCapacitacion"));
		
		List<Empleado> listaEmpleados = (List<Empleado>)request.getSession().getAttribute("listaEmpleados");
		Empleado empleado = listaEmpleados.get(idxEmpleado);
		empleado.capacitarPendiente(idCapacitacion);
		
		
		return mapping.findForward("success");
	}
	
}
